<template>
    <div class="lefter-btn-container">
        <div :class="[checked?'lefter-btn-box-active':'lefter-btn-box']" @click="checkBtn">
            <div class="message-box">
                <div style="display: flex; align-items: center">
                    <img :src="imgPath">
                    <div style="width: 10px"></div>
                    <div class="btn-name">{{name}}</div>
                </div>
                <div>{{count}}</div>
            </div>
        </div>
    </div>
</template>

<script>

export default {
    name: "playListBtn",
    props:['type', 'id', 'checked', 'imgPath', 'count', 'name'],
    emit:['checkLefterBtn'],
    setup(props, context) {

        function checkBtn() {
            context.emit('checkLefterBtn', props.id, props.type)
        }

        return {
            checkBtn,
        }
    }
}
</script>

<style scoped>
.lefter-btn-container {
    position: relative;
    padding: 0px 10px 10px 10px;
    width: calc(100% - 20px);
    height: 50px;

}

.lefter-btn-box {
    position: relative;
    width: 100%;
    height: 100%;
    background-color: rgb(243, 243, 245);
    border-radius: 5px;
    color: red;
    transition: all 300ms ease-in-out;
}

.lefter-btn-box:hover {
    background-color: white;
    box-shadow: 0 2px 10px rgb(235, 235, 236);
}

.lefter-btn-box-active {
    position: relative;
    width: 100%;
    height: 100%;
    background-color: red;
    border-radius: 5px;
    color: white;
    transition: all 300ms ease-in-out;
}

.btn-name {
    width: 165px;
    text-overflow: ellipsis;
    overflow: hidden;
    white-space:nowrap
}

.message-box {
    pointer-events: none;
    display: flex;
    align-items: center;
    justify-content: space-between;
    position: absolute;
    padding: 10px;
    width: calc(100% - 20px);
    height: calc(100% - 20px);
    font-size: 17px;
}

.message-box img {
    width: 30px;
    height: 30px;
}
</style>